\newcommand{\doctitle}{Quick Reference}

\input{./settings/packages}
\input{./settings/macros}
\input{./settings/styles}

\begin{document}

\thispagestyle{titleslide}
\vspace*{-\headsep}

\begin{center}
	\vspace{\stretch{2}}

	\includegraphics[width=0.8\textwidth]{hmspp_logo_nowhite.pdf}

	{\wahydcolour%
	\rule{\textwidth}{\myrulewidth}
	}

	{\Huge
		\doctitle
	}

	\vspace{\stretch{3}}
\end{center}

\newpage

\newcommand{\setSlideCaption}[1]{\renewcommand{\slideCaption}{#1}}

%\renewcommand{\slideCaption}{Outline}
\pagestyle{slidestyle}

\def\outlineItems{
About this document,
About \hms,
Installing \hms,
Using \hms,
Extending \hms
}


\newcounter{itemCounter}
\newcounter{itemCounterBak}

% first  arg is the 1-based index of the item to be highlighted
% second arg is the 1-based index of the item to be expanded
\newcommand{\itemSymb}[2]{%
	\ifnumequal{\value{itemCounter}}{#2}{%
		\ifnumequal{\value{itemCounter}}{#1}{$\blacktriangledown$}{$\triangledown$}%
	}{%
		\ifnumequal{\value{itemCounter}}{#1}{$\blacktriangleright$}{$\vartriangleright$}%
	}%
}

\newcommand{\itemExpansion}[2]{%
	\ifnumequal{\value{itemCounter}}{#1}{#2}{}%
}

\newcommand{\setCaptionToHighlight}[2]{%
	\ifnumequal{\value{itemCounter}}{#1}{\global\let\nextSlideCaption=#2}{}%
}

% first arg is the list,
% second arg is the 1-based index of the item to be highlighted,
% third  arg is the 1-based index of the item to be expanded
% fourth arg is the expansion content
\newcommand{\printItems}[4]{
	\setcounter{itemCounterBak}{\value{itemCounter}}
	\setcounter{itemCounter}{1}
	\begin{itemize}
		\foreach \it in #1 {%
			\item[%
			\itemSymb{#2}{#3}%
			] \it%
			\setCaptionToHighlight{#2}{\it}
			\itemExpansion{#3}{#4}
			\stepcounter{itemCounter}%
		}
	\end{itemize}
	\setcounter{itemCounter}{\value{itemCounterBak}}
}


\newcommand{\printOutline}[3]{%
	\renewcommand{\slideCaption}{Outline}
	\printItems{\outlineItems}{#1}{#2}{#3}%
	\newpage
	\setSlideCaption{\nextSlideCaption}
%	\phantomsection
}

\printOutline{0}{0}{}
\subimport{sections}{about_guide}
\subimport{sections}{about_hms}
\subimport{sections}{install}
\subimport{sections}{use}
\subimport{sections}{extend}


\end{document}